<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:mo="https://gitee.com/aun/Timo1"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<body>

<div class="layui-card">

    <div class="layui-card-header">
        <span class="layui-icon font-s10 color-desc margin-right-5"></span>服务权限申请
        <div class="pull-right">
<!--            <button data-table-id="NoticeTable" class="layui-btn layui-btn-primary  layui-btn-sm" data-modal="/system/user/form" data-height="720px" data-width="800px">-->
<!--                <i class=" layui-icon layui-icon-addition"></i>新建护工</button>-->
        </div>
    </div>

    <div class="layui-card-line"></div>

    <div class="layui-card-body">

        <div class="layui-card-table layui-tab">
            <div class="layui-tab-content">
                <form th:replace="/pcs/porter_permission/index_search">

                </form>
                <table id="PorterPermissionTable" data-url="/pcs/porter/permission/index" data-target-search="form.form-search"></table>
                <script type="text/javascript" th:inline="none">
                    $(function () {
                        $('#PorterPermissionTable').layTable({
                            even: true, height: 'full',
                            cols: [[
                                {checkbox: true, fixed: true, width: 60},
                                {title: '序号', type: 'numbers', width: 80},
                                {field: 'name', title: '陪护员姓名', minWidth: 180, align: 'center'},
                                {field: 'sex', title: '性别', align: 'center', templet: function (d) {
                                    if (d.sex == 1) {
                                        return '男';
                                    } else if (d.sex == 2) {
                                        return '女';
                                    } else {
                                        return '未知';
                                    }
                                }},
                                {field: 'age', title: '年龄', align: 'center'},
                                {field: 'phone', title: '手机号', align: 'center', minWidth: 110},

                                {field: 'permission', title: '护理科室权限', align: 'center',templet: function (d) {
                                    var permission = d.porterPermissions;
                                    if (permission.length > 0) {
                                        var str = '';
                                        permission.forEach(function (item, index){
                                            if(item.verifyStatus==1){
                                                str += '<span class="layui-badge layui-bg-green">'+item.depName+'</span>';
                                            }else{
                                                str += '<span class="layui-badge layui-bg-gray">'+item.depName+'</span>';
                                            }
                                        })
                                        return str;
                                    } else {
                                        return '无';
                                    }
                                }},
                                {field: 'companyName', title: '陪护公司', align: 'center', minWidth: 250},
                                {toolbar: '#toolbar', title: '操作', align: 'center', minWidth: 200, fixed: 'right'}
                            ]]
                        });
                    });



                </script>



                <script type="text/html" id="toolbar">
                    <a class="layui-btn layui-btn-sm" data-event-dbclick data-title="护理权限申请" shiro:hasPermission="pcs:porterPermission:add"  data-width="1200px" data-height="800px"  data-modal='/pcs/porter/permission/form?ids={{d.id}}'>护理权限申请</a>
                    <a class="layui-btn layui-btn-sm" style="background-color: #16baaa" data-event-dbclick data-title="申请记录"     data-modal='/pcs/porter/permission/log?id={{d.id}}'>申请记录</a>

                </script>

            </div>
        </div>
    </div>

</div>
</body>
</html>